package com.goldman.message.common.event;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class MessageModel<T> {
	/**
	 * 消息id
	 */
    private String msgId;

    /**
     * 消息类型
     */
    private String type;

    /**
     * 主题
     */
    private String destination;
    /**
     * 消息内容<br>
     * 建议使用json格式数据，这样系统间就没有依赖关系
     */
    private T data;

    public MessageModel(String msgId, String type, T data) {
        this.msgId = msgId;
        this.type = type;
        this.data = data;
    }

    public MessageModel(String msgId, String type, T data, String destination) {
        this.msgId = msgId;
        this.type = type;
        this.data = data;
        this.destination = destination;
    }
}
